package com.yaozheng.vocationaltraining.service.impl;

import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.EBean;

import com.yaozheng.vocationaltraining.iview.IBaseView;
import com.yaozheng.vocationaltraining.iview.ITokenBaseView;
import com.yaozheng.vocationaltraining.service.StartupService;
import com.yaozheng.vocationaltraining.utils.Constants;
import com.yaozheng.vocationaltraining.utils.ErrorUtils;
import com.yaozheng.vocationaltraining.utils.http.okhttp.OkHttpClientManager;

@EBean
public class StartupServiceImpl implements StartupService {
	ITokenBaseView iBaseView;

	@Override
	public void init(ITokenBaseView iBaseView) {
		this.iBaseView = iBaseView;
	}

	@Background
	@Override 
	public void getStartupData() {
		try {
			OkHttpClientManager.getInstance().get(
					Constants.ROOTURL + "/system/startup", iBaseView.getToken(), iBaseView);
		} catch (Exception e) {
			ErrorUtils.outErrorLog(e);
			if (iBaseView.isResponseResult()) {
				iBaseView.responseError(ErrorUtils.SERVER_CONNECTION_ERROR);
			}

		}
	}

}
